package com.example.server.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.dao.UserDao;
import com.example.pojo.Users;
import com.example.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<Users> findAll(Users users) {
     return userDao.selectList(null);


    }

    @Override
    public void add(Users users) {
        userDao.insert(users);
    }

    @Override
    public Users findById(String id) {
        return userDao.selectById(id);
    }

    @Override
    public void update(Users users) {
        userDao.updateById(users);
    }

    @Override
    public void del(String id) {
        userDao.deleteById(id);
    }

    @Override
    public void findSelect(String age) {
        LambdaQueryWrapper<Users> queryWrapper = new LambdaQueryWrapper<>();
        if (age!=null){
            queryWrapper.gt(Users::getAge,age);
        }

        userDao.selectList(queryWrapper);
    }










}
